extends Control


var data = null

func _ready():
	pass 



func set_data(data):
	self.data = data
	rect_position = Vector2(data["x"]+50000, data["y"]+50000)
	
	$Label.text = "【%s】恢复中心：%s" %[data["id"], data["description"]]


func _on_del_ok(data):
	DataSource.delete_data_by_id(DataSource.map_center_recover, data["id"])
	
	var map_view = MainTool.getUILayer().get_ui("MapView")
	map_view.entity_update()
	


func _on_gui_input(event):
	if event is InputEventMouseButton:  
		if event.button_index == BUTTON_RIGHT and event.pressed:  
			# 鼠标右键被按下，确认删除
			MainTool.confirm("你是否确认删除该恢复中心", self, "_on_del_ok", null, data)



func _on_MapCenterRecover_button_up():
	var ui = MainTool.getUILayer().add_ui("res://tool/page/map/mapView/modal/MapCenterRecoverModal.tscn", 0, false)
	ui.set_edit_data(data)
